#include "GameMessage.h"
#include "GameMessageFactory.h"
#include "GMSetID.h"
#include "GMRequestID.h"
#include "GMClientDisconnectRequest.h"
#include "GMClientServerPing.h"
#include "GMServerClientPing.h"
#include "GMRequestTime.h"
#include "GMSetTime.h"
#include "GMKeyChangeSDL.h"
#include "GMCreateNetworkedActor.h"
#include "GMCreateClientActor.h"
#include "GMClientRequestPlayer.h"
#include "GMActorChanges.h"
#include "GMKeyChangeDirectInput.h"
#include "GMDestroyClientActor.h"

//Set the Name
const char* GMSetID::NAME = "GMSetID";
const char* GMRequestID::NAME = "GMRequestID";
const char* GMClientDisconnectRequest::NAME = "GMClientDisconnectRequest";
const char* GMClientServerPing::NAME = "GMClientServerPing";
const char* GMServerClientPing::NAME  = "GMServerClientPing";
const char* GMRequestTime::NAME  = "GMRequestTime";
const char* GMSetTime::NAME  = "GMSetTime";
const char* GMKeyChangeSDL::NAME  = "GMKeyChangeSDL";
const char* GMCreateClientActor::NAME  = "GMCreateClientActor";
const char* GMCreateNetworkedActor::NAME  = "GMCreateNetworkedActor";
const char* GMClientRequestPlayer::NAME  = "GMClientRequestPlayer";
const char* GMActorChanges::NAME  = "GMActorChanges";
const char* GMKeyChangeDirectInput::NAME  = "GMKeyChangeDirectInput";
const char* GMDestroyClientActor::NAME  = "GMDestroyClientActor";

//Write the creation function
GameMessage* CreateGMSetID()
{
    return new GMSetID;
}
GameMessage* CreateGMRequestID()
{
    return new GMRequestID;
}
GameMessage* CreateGMClientDisconnectRequest()
{
    return new GMClientDisconnectRequest;
}
GameMessage* CreateGMClientServerPing()
{
    return new GMClientServerPing;
}
GameMessage* CreateGMRequestTime()
{
    return new GMRequestTime;
}
GameMessage* CreateGMServerClientPing()
{
    return new GMServerClientPing;
}
GameMessage* CreateGMSetTime()
{
    return new GMSetTime;
}
GameMessage* CreateGMKeyChangeSDL()
{
    return new GMKeyChangeSDL;
}
GameMessage* CreateGMCreateClientActor()
{
	return new GMCreateClientActor;
}
GameMessage* CreateGMCreateNetworkedActor()
{
	return new GMCreateNetworkedActor;
}
GameMessage* CreateGMClientRequestPlayer()
{
    return new GMClientRequestPlayer;
}
GameMessage* CreateGMActorChanges()
{
    return new GMActorChanges;
}
GameMessage* CreateGMKeyChangeDirectInput()
{
    return new GMKeyChangeDirectInput;
}
GameMessage* CreateGMDestroyClientActor()
{
    return new GMDestroyClientActor;
}

//Allow access to the NAME variable
const char* GMSetID::GetTypeName() const
{
    return NAME;
}
const char* GMRequestID::GetTypeName() const
{
    return NAME;
}
const char* GMClientDisconnectRequest::GetTypeName() const 
{
    return NAME;
}
const char* GMClientServerPing::GetTypeName() const
{
    return NAME;
}
const char* GMServerClientPing::GetTypeName() const
{
    return NAME;
}
const char* GMRequestTime::GetTypeName() const
{
    return NAME;
}
const char* GMSetTime::GetTypeName() const
{
    return NAME;
}
const char* GMKeyChangeSDL::GetTypeName() const
{
    return NAME;
}
const char* GMCreateClientActor::GetTypeName() const
{
	return NAME;
}
const char* GMCreateNetworkedActor::GetTypeName() const
{
	return NAME;
}
const char* GMClientRequestPlayer::GetTypeName() const
{
    return NAME;
}
const char* GMActorChanges::GetTypeName() const
{
    return NAME;
}
const char* GMKeyChangeDirectInput::GetTypeName() const
{
    return NAME;
}
const char* GMDestroyClientActor::GetTypeName() const
{
    return NAME;
}

//set the creation function
void GameMessage::StaticPrepareFactory() 
{
    TheGameMessageFactory::Instance()->AddType(GMSetID::NAME, &CreateGMSetID);
    TheGameMessageFactory::Instance()->AddType(GMRequestID::NAME, &CreateGMRequestID);
    TheGameMessageFactory::Instance()->AddType(GMClientDisconnectRequest::NAME, &CreateGMClientDisconnectRequest);
    TheGameMessageFactory::Instance()->AddType(GMClientServerPing::NAME, &CreateGMClientServerPing);
    TheGameMessageFactory::Instance()->AddType(GMServerClientPing::NAME, &CreateGMServerClientPing);
    TheGameMessageFactory::Instance()->AddType(GMRequestTime::NAME, &CreateGMRequestTime);
    TheGameMessageFactory::Instance()->AddType(GMSetTime::NAME, &CreateGMSetTime);
    TheGameMessageFactory::Instance()->AddType(GMKeyChangeSDL::NAME, &CreateGMKeyChangeSDL);
	TheGameMessageFactory::Instance()->AddType(GMCreateClientActor::NAME, &CreateGMCreateClientActor);
	TheGameMessageFactory::Instance()->AddType(GMCreateNetworkedActor::NAME, &CreateGMCreateNetworkedActor);
    TheGameMessageFactory::Instance()->AddType(GMClientRequestPlayer::NAME, &CreateGMClientRequestPlayer);
    TheGameMessageFactory::Instance()->AddType(GMActorChanges::NAME, &CreateGMActorChanges);
    TheGameMessageFactory::Instance()->AddType(GMKeyChangeDirectInput::NAME, &CreateGMKeyChangeDirectInput);
    TheGameMessageFactory::Instance()->AddType(GMDestroyClientActor::NAME, &CreateGMDestroyClientActor);
}
